package com.shengyuan.manage_os.old.ying.erpm;

import java.util.ArrayList;
import java.util.List;

import com.shengyuan.manage_os.R;
import com.shengyuan.manage_os.old.ying.erpm.data.MenuItem;
import com.shengyuan.manage_os.old.ying.erpm.layout.Workspace.OnViewChangedListener;
import com.shengyuan.manage_os.old.ying.erpm.tasks.Submit_System_Setting_Data_Task;

import android.content.Intent;
import android.content.res.Resources;
import android.os.Handler;
import android.os.Message;

public class XingZhengActivity extends WorkSpaceActivity implements OnViewChangedListener {

	@Override
	public List<MenuItem> LoadMenuListItems() 
    {
    	MenuItem item;
    	List<MenuItem> list = new ArrayList<MenuItem>();
    	Resources res =getResources();
    	String[] city=res.getStringArray(R.array.main_menus_xz);
    	for (int i = 0; i < city.length; i++) {
    		item = new MenuItem();
			item.title = city[i];
			item.index = i;
			list.add( item);
		} 
    	return list;
    }

    private Handler mHandler= new Handler(){

		@Override
		public void handleMessage(Message msg) {
			BaseActivity.A_GONGCHENGMINGCHENG = Submit_System_Setting_Data_Task.A_GONGCHENGMINGCHENG_OA;
			BaseActivity.J_GONGCHENGMINGCHENG = Submit_System_Setting_Data_Task.J_GONGCHENGMINGCHENG_OA;
			BaseActivity.A_GONGCHENGMINGCHENG_XIANGMU = Submit_System_Setting_Data_Task.A_GONGCHENGMINGCHENG_OA_XIANGMU;
			BaseActivity.J_GONGCHENGMINGCHENG_XIANGMU = Submit_System_Setting_Data_Task.J_GONGCHENGMINGCHENG_OA_XIANGMU;
			Intent intent = new Intent();
            switch (msg.what) {
            case 0:
            	intent.setClass(XingZhengActivity.this, Actual_OA_BaoXiaoDan.class);
            	break;
            }
            startActivity(intent);
		}
    	
    };
/*   
 *  2	总经理
    3	行政人事部
    4	财务审计部
    5	工程机械部
    6	市场部典当行
    7	经营计划部
    8	网络工程部
 * 
 */

	@Override
	public boolean IsAllow() {
		if (LoginActivity.pmUser.getLogOut() == false) {
			return LoginActivity.pmUser.JiaoSe.contains("超级管理员")
					|| LoginActivity.pmUser.JiaoSe.contains("总经理")
					|| LoginActivity.pmUser.JiaoSe.contains("副总经理")
					|| LoginActivity.pmUser.JiaoSe.contains("董事长")
					|| LoginActivity.pmUser.JiaoSe.contains("人事专员")
					|| LoginActivity.pmUser.JiaoSe.contains("行政专员");
		}else {
			return false;
		}
	}


	@Override
	public Handler GetHandler() {
		return mHandler;
	}	
}